// 交易类型定义
export interface Transaction {
  id?: number
  type: 'income' | 'expense'
  amount: number
  categoryId: number
  category?: Category
  description?: string
  date: Date | string
  account: 'cash' | 'bank_card' | 'alipay' | 'wechat' | 'credit_card' | 'other'
  isRecurring?: boolean
  recurringType?: 'daily' | 'weekly' | 'monthly' | 'yearly'
  tags?: string[]
  createdAt?: Date | string
  updatedAt?: Date | string
}

// 分类类型定义
export interface Category {
  id?: number
  name: string
  type: 'income' | 'expense'
  icon: string
  color: string
  isSystem: boolean
  sortOrder: number
  isActive: boolean
  createdAt?: Date | string
  updatedAt?: Date | string
}

// 统计概览类型定义
export interface Overview {
  totalIncome: number
  totalExpense: number
  balance: number
  transactionCount: number
  incomeCount: number
  expenseCount: number
}

// 分类统计类型定义
export interface CategoryStats {
  categoryId: number
  totalAmount: number
  count: number
  type: 'income' | 'expense'
  categoryName: string
  categoryIcon: string
  categoryColor: string
}

// 月度统计类型定义
export interface MonthlyStats {
  month: number
  income: number
  expense: number
  incomeCount: number
  expenseCount: number
  balance: number
}

// 账户统计类型定义
export interface AccountStats {
  account: string
  accountName: string
  income: number
  expense: number
  incomeCount: number
  expenseCount: number
  balance: number
}

// API响应类型定义
export interface ApiResponse<T = any> {
  status: 'success' | 'error'
  message?: string
  data?: T
  error?: string
}

// 账户类型映射
export const ACCOUNT_TYPES = {
  cash: '现金',
  bank_card: '银行卡',
  alipay: '支付宝',
  wechat: '微信',
  credit_card: '信用卡',
  other: '其他'
} as const

// 默认分类图标映射
export const CATEGORY_ICONS = {
  // 收入类
  salary: '💰',
  bonus: '🎁',
  investment: '📈',
  'part-time': '💼',
  
  // 支出类
  food: '🍽️',
  transport: '🚗',
  shopping: '🛍️',
  entertainment: '🎬',
  medical: '🏥',
  education: '📚',
  housing: '🏠',
  communication: '📱',
  other: '📝',
  default: '📝'
} as const